import{
    INCREMENTCOUNT,
    DECREMENTCOUNT
} from '../constant/countConst'
import store from '../store'
export const incrementAction =(data=1)=>{
    return{
        type: INCREMENTCOUNT,
        data
    }
}
export const decrementAction =(data=1)=>{
    return{
        type: DECREMENTCOUNT,
        data
    }
}
//将异步代码交给action来处理
export const waitIncrementAction =(data)=>{
    //返回一个函数
    return ()=>{
        setTimeout(() => {
            store.dispatch({
                type: INCREMENTCOUNT,
                data
              })
        },2000);
    }
}

